<?php

//class booksearch
//{
//
// public $query;
// public $server;
// public $guild;
// public $sstring;
// public $page;
//
//
//	function pull_xml()
//	{
			//$url = 'http://books.google.com/books/feeds/volumes?q=hamlet&max-results=1&alt=rss-in-script&prettyprint=true&fields=entry(id,author/name)';
			//$enc = urlencode('entry(id,author/name)');
			//$url = 'http://books.google.com/books/feeds/volumes?q=hamlet&max-results=1&alt=atom&fields=' . $enc;
			//$enc = urlencode('@gd:*,id,entry(@gd:*,title,link[@rel="edit"])');
			$search = 'hamlet';
			$key = '&key=AIzaSyCRU7aoyd12XlidFdIo9cLJYjK6BUKtt1g';
			$url = 'https://googleapis.com/books/v1/volumes?q='.$search.'&max-results=10'.$key;
			//GET https://www.googleapis.com/books/v1/volumes?q=flowers+inauthor:keyes&key=yourAPIKey
			//&alt=atom&fields=' . $enc;
			//https://www.googleapis.com/books/v1/volumes?q=search+terms

			//$url2 = 'http://books.google.com/books/feeds/volumes?q=hamlet&max-results=1&alt=rss-in-script&prettyprint=false';
			//$url = 'http://books.google.com/books/feeds/volumes?q=hamlet&max-results=10&fields=link';
			//$url = 'http://books.google.com/books/feeds/volumes?q=hamlet&max-results=10&alt=atom-in-script';
	
/*
	Client ID: 	832654043401.apps.googleusercontent.com
Email address: 	832654043401@developer.gserviceaccount.com
Client secret: 	EA-CDgXLgBHZR224td69wGe2
API key: 		AIzaSyCRU7aoyd12XlidFdIo9cLJYjK6BUKtt1g
*/
	//author=
	//fields=
	
			const BROWSER="Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.8.1.2) Gecko/20070319 Firefox/2.0.0.3";
			$ch = curl_init();
			curl_setopt ($ch, CURLOPT_URL, $url);
			curl_setopt ($ch, CURLOPT_SSL_VERIFYHOST, 0); 
			curl_setopt ($ch, CURLOPT_SSL_VERIFYPEER, 0);
			curl_setopt ($ch, CURLOPT_RETURNTRANSFER, 1);
			curl_setopt ($ch, CURLOPT_CONNECTTIMEOUT, 15);
			//curl_setopt ($ch, CURLOPT_USERAGENT,  self::BROWSER);
			
			$url_string = curl_exec($ch);
			curl_close($ch);
			echo $url_string;
			
//	
//	}
//}
//
//$xml = $booksearch->pull_xml();
//$raw = var_export($xml, true);

//$get =  str_replace(@file_get_contents($url),'\n','<br/>');
$get = @file_get_contents($url);
$get2 = $_GET[$url];
//$get = str_replace('\n','<br/>',$get);

//$testdet = simplexml_load_string($get);
//$raw = var_export($testdet, true);
echo $url;
echo $get;
echo $get2;
//echo $testdet;
//echo $raw;

//$get2 = @file_get_contents($url2);

//echo $get2;



?>